<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    

    <title>msg-首页</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <base href="./">
    <base target="_blank">
    <link rel="shortcut icon" href="favicon.ico"> <link href="assets/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="assets/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="assets/css/animate.min.css" rel="stylesheet">
    <link href="assets/css/style.min.css?v=4.0.0" rel="stylesheet">

</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">

        <div class="row">
            
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">
                        <form class="form-horizontal m-t" id="commentForm">
							
							<!-- 个人信息 -->	
                            <div class="form-group">
								<div class="ibox-content" id="userinfo_div">
									<h3>游客</h3>
									<h4>余额
										<small>0.0元</small>
									</h4>
								</div>
								
							</div>

							<!-- 业务操作区域 -->	
							<div class="form-group">
								<label class="col-sm-1 control-label">手机号：</label>
								<div class="col-sm-2" style="margin-bottom: 10px;">
									<input id="phone" name="phone" minlength="2" type="text" class="form-control" readonly="readonly">
								</div>
								<div class="col-sm-2" style="margin-bottom: 10px;">
									<button class="btn btn-primary" type="button" onclick="getPhone()">获取手机号</button>
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-1 control-label">验证码：</label>
								<div class="col-sm-4">
									<textarea id="concent" class="form-control" rows="3" cols="20"></textarea>
								</div>
							</div>

							<!-- 使用步骤 -->	
                            <div class="form-group">
                                
								<div class="ibox-content">
									<h4>使用步骤：</h4>
									<ol>
										<li>注册账户，联系管理员领取金币。</li>
										<li>登录系统，点击获取手机号。</li>
										<li>将系统提供的手机号粘贴到手机，并申请发送验证码。</li>
										<li>等待系统返回验证码信息，并输入至手机。</li>
									</ol>
									<h5>注：</h5>
									<ol>
										<li>每次获取手机号将会扣除少量的金币,点击获取验证码之后请耐心等待1~2分钟。</li>
										<li>由于网络风险,可能会导致获取的手机号无法登陆,或者登录后已经被使用,请知悉。</li>
									</ol>
								</div>
							
							</div>

							<!-- 声明 -->	
                            <div class="form-group">
                                
								<div class="ibox-content">
									<h2>声明：</h2>
									<p>
											本站为管理员测试网站，仅用于技术研究使用，严禁商业使用（包括但不限于恶意注册账户、套取积分、优惠券、奖励金等）！
									</p>
									<p>
											感兴趣的朋友可以联系管理员（Qq：1141775630）共同学习！
									</p>
									<p>
											如有侵权,请联系管理员。
									</p>
								</div>
							
							</div>

                        </form>
                    </div>
				</div>
				
        </div>
    </div>
    <script type="text/javascript" src="config.js"></script>
    <script type="text/javascript" src="assets/js/jquery.min.js?v=2.1.4"></script>
    <script type="text/javascript" src="assets/js/bootstrap.min.js?v=3.3.5"></script>
    <script type="text/javascript" src="assets/js/axios.min.js"></script>
    <script type="text/javascript" src="assets/js/formSerialize.js"></script>
    <script type="text/javascript" src="assets/js/common.js"></script>
    <script type="text/javascript" src="assets/plugins/layer/layer_v3.1.1/layer.js"></script>
    <script>
		
		var account = null;
		//获取账号信息
		$('#userinfo_div h3').html(userInfo.nickname)
		function getAccountInfo(){
			axios.get('/xinmaAccount/getAccountInfo/api')
			.then(function (response) {
				layer.closeAll('loading');
				if(response.result){
					account = response.data;
					if(account != null){
						$('#userinfo_div small').html(account.money + '元')
					};
				}else{
					layer.msg(response.msg);
				};
				
			})
		}
		getAccountInfo();
		var _code = '';	
		// 获取手机号
        function getPhone(){
			//验证余额
			if(account.money < 0.1){
				layer.msg('余额不足!');
				return false;
			}
			
			layer.load(0);
			axios.get('/xinmaMessage/getPhone/api?itemId='+_ItemId)
				.then(function (response) {
					layer.closeAll('loading');
					layer.msg(response.msg);
					if(response.result){
						var data = response.data;
						if(data.phone == null){
							layer.msg('请求失败,请联系管理员！');
							return false;
						}
						$('#phone').val(data.phone);
						_code = data.code;
						getMessage();
					};
					
				})
		}
		
		// 获取消息
        function getMessage(){
			var par = '?code='+_code+'&t='+(new Date()).getTime()
			axios.get('/xinmaMessage/getMessage/api' + par)
				.then(function (response) {
					if(response.result){
						var data = response.data;
						if(data!=null){
							layer.msg(response.msg);
							$('#concent').val(data);
							getAccountInfo();
						}else{
							setTimeout(function(){
		            			getMessage();
							}, 3000);
						};
						
					};
				})
        }

    </script>
</body>

</html>